package com.nebula.salary.model.pojo;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 菜单表
 * </p>
 *
 * @author codex
 * @since 2022-01-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("tb_navigation")
@ApiModel(value="Navigation对象", description="菜单表")
public class Navigation implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜单ID")
    @TableId(value = "nav_id", type = IdType.AUTO)
    private Integer navId;

    @ApiModelProperty(value = "菜单标题")
    private String item;

    @ApiModelProperty(value = "菜单图标")
    private String icon;

    @ApiModelProperty(value = "控制器路径")
    private String url;
    
    @ApiModelProperty(value = "菜单路径")
    private String path;
    
    @ApiModelProperty(value = "组件名称")
    private String component;
    
    @ApiModelProperty(value = "菜单描述")
    private String instruction;

    @ApiModelProperty(value = "菜单父节点(父节点 0表示根节点)")
    private Integer parentId;

    @ApiModelProperty(value = "排序标识")
    private Integer sort;
    
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdTime;
    
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;
    
    @ApiModelProperty(value = "子菜单")
    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Navigation> children = new ArrayList<>();
    
    @ApiModelProperty("角色列表")
    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Role> roles;
    
	public static final String NAV_ID = "nav_id";

    public static final String ITEM = "item";

    public static final String ICON = "icon";

    public static final String URL = "url";
    
    public static final String PATH = "path";
    
    public static final String COMPONENT = "component";

    public static final String INSTRUCTION = "instruction";

    public static final String PARENT_ID = "parent_id";

    public static final String SORT = "sort";

    public static final String CREATED_TIME = "created_time";

    public static final String UPDATED_TIME = "updated_time";

}
